'use strict'

angular.module('mainApp')
.directive('star', function(){
    return {
        restrict: 'E',
        scope: {
            score: '='
        },
        template: '<i class="fa font-orange" ng-class="star" ng-repeat="star in stars" style="margin-right: 5px"></i>',
        replace: true,
        link: function(scope){
            scope.stars = [];
            for(var i = 1; i <= 5; i ++){
                scope.stars.push({
                    'fa-star': i <= scope.score,
                    'fa-star-o': i > scope.score
                })
            }
        }
    }
})